package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@JsonIgnoreProperties("handler")
public class SceneIntroduce {
    public static final Integer LEVEL_A = 0; //A级景区
    public static final Integer LEVEL_AA = 1; //AA级景区
    public static final Integer LEVEL_AAA = 2; //AAA级景区
    public static final Integer LEVEL_AAAA = 3; //AAAA级景区
    public static final Integer LEVEL_AAAAA = 4; //AAAAA级景区

    private Long commendId;

    private SceneCommend commend;

    private String imgUrl;

    private String address;

    private String name;

    private Integer level = LEVEL_A;

    public String getLevelName() {
        String msg = "A级景区";
        if (level == LEVEL_AA) {
            msg = "AA级景区";
        } else if (level == LEVEL_AAA) {
            msg = "AAA级景区";
        } else if (level == LEVEL_AAAA) {
            msg = "AAAA级景区";
        } else if (level == LEVEL_AAAAA) {
            msg = "AAAAA级景区";
        }
        return msg;
    }


    public String getJson() {
        Scene scene = commend.getScene();
        Map<String, Object> map = new HashMap<>();
        if (scene != null) {
            map.put("price", scene.getPrice());
        }
        map.put("imgUrl", imgUrl);
        map.put("address", address);
        map.put("name", name);
        map.put("level", level);
        if (commend != null) {
            map.put("commendId", commend.getId());
            map.put("commendTitle", commend.getTitle());
        }
        return JSONUtil.toJSONString(map);
    }

}